$(function (){
    $.ajax({
        type: "post",
        url: "/findGoods",
        dataType:"json",
        success:function(data){
            for (let i=0;i<data.length;i++){
                let categoryId = null;
                if(data[i].categoryId=='1'){
                    categoryId = '图书'
                }
            var $tr = $("<tr>"+

                        "<td><img th:src='@{/image/data[i].itemImge}'></td>," +
                        "<td>" + data[i].itemName + "</td>," +
                        "<td>" + data[i].itemUnit + "</td>," +
                        "<td>" + data[i].itemDescribe + "</td>," +
                        "<td>" + data[i].itemPrice + "</td>," +
                        "<td>" + categoryId + "</td>," +
                        "<td>" + data[i].articleNumber + "</td>," +
                        "<td>" + data[i].itemCount + "</td>," +
                        "<td>" + data[i].stock + "</td>," +
                        "</tr>"
            )
                $("table").append($tr);
            }
        },error:function (e){
            alert("请求失败")
        }

    })
})